using System;
using GameBase;
using UnityEngine;

namespace AutoChess
{
    class ActorFactory : Singleton<ActorFactory>
    {
        public const string ActorModelNodeName = "Model";
        public delegate void OnCreateModel(GameObject go);

        public GameObject CreateGoByPrefabPath(string prefabPath, OnCreateModel onModelCreate)
        {
            var go = BResources.AllocGameObject(prefabPath);
            if (go != null)
            {
                go.name = ActorModelNodeName;
            }

            if (onModelCreate != null)
            {
                onModelCreate(go);
            }

            return go;
        }
        
    }
}